package com.four.marketing.controller;


import com.four.marketing.entity.Allocation;
import com.four.marketing.service.AllocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 侯新伟
 * @since 2021-12-14
 */
@RestController
@RequestMapping("mark/allocation")
public class AllocationController {

    @Autowired
    private AllocationService allocationService;

    /**
     * 秒杀列表
     * @param seName
     * @param allStatus
     * @return
     */
    @GetMapping("/allocationList")
    public List<Allocation>allocationList(@RequestParam("seName")String seName,
                                          @RequestParam("allStatus")String allStatus){
        return allocationService.allocationList(seName,allStatus);
    }

    /**
     * 秒杀删除
     * @param id
     */
    @DeleteMapping("/allocationDelete")
    public void allocationDelete(@RequestParam("id")Integer id){
        allocationService.allocationDelete(id);
    }
    /**
     * 秒杀添加配置
     */
    @PostMapping("/allocationAdd")
    public  void  allocationAdd(Allocation allocation){
        allocationService.allocationAdd(allocation);
    }

    /**
     * 秒杀编辑
     * @param allocation
     */
    @PostMapping("/allocationUpdate")
    public  void  allocationUpdate(Allocation allocation){
        allocationService.allocationUpdate(allocation);
    }


}
